<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="电影类名">
        <el-input width="120px" v-model="form.category_name" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">添加</el-button>
<!--        <el-button @click="onCancel">取消</el-button>-->
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import { updateMovieCategory } from '@/api/movieCategory'

  export default {
  data() {
    return {
      form: {
        pid:0,
        catetory_name: ''
      }
    }
  },
  methods: {
    onSubmit() {
      let params = {
        pid:this.form.pid,
        category_name:this.form.category_name
      }
      updateMovieCategory(params).then(response => {
        if(response.data == 1){
          this.$message({
            showClose: true,
            message: '添加成功',
            type: 'success'
          });
        }
      })
      this.$router.push({ path: `cateTable` })
    },
    onCancel() {
      this.$message({
        message: '取消添加',
        type: 'warning'
      })
      this.form.catetory_name = ''
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
</style>

